package com.ruoyi.equip.util;

import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.equip.domain.EquipProduct;
import com.ruoyi.equip.domain.cache.DeviceTagCache;

import java.util.HashMap;
import java.util.concurrent.TimeUnit;

public class ProductCacheUtils {

    public static HashMap<String,Integer> aliveTimeMap=new HashMap<>();


    /**
     * 设置设备缓存
     */
    public static void setAliveTime(EquipProduct equipProduct) {
        aliveTimeMap.put(getCacheKey(equipProduct.getProductKey()), equipProduct.getKeepAliveTime());
    }



    /**
     * 移除
     */

    public static void removeAliveTime(String key) {
        aliveTimeMap.remove(getCacheKey(key));
    }

    /**
     * 设置cache key
     *
     * @param configKey 参数键
     * @return 缓存键key
     */
    public static String getCacheKey(String configKey) {
        return CacheConstants.PRODUCT_KEY + configKey;
    }



}
